package org.rendao.validator
{
	import mx.validators.ValidationResult;
	import mx.validators.Validator;
	
	import org.rendao.utils.DateUtils;
	
	public class DateTimeStringValidator extends Validator
	{
		public function DateTimeStringValidator()
		{
			super();
		}
		
		override protected function doValidation(value:Object):Array {
			var inputValue:String = String(value);
			var results:Array = [];
			
			results = super.doValidation(value);        
			if(results.length > 0)
				return results;
			
			if(!DateUtils.isValidDateString(inputValue)) {
				results.push(new ValidationResult(true, null, "NaN", 
					"日期格式错误"));
				return results;
			}       
			
			return results;
		}
	}
}